@namespace MudBlazor.Docs.Examples

<MudTreeView Items="@TreeItems" Hover="true" Width="100%">
    <ItemTemplate Context="item">
        <MudTreeViewItem Items="@item.TreeItems" Icon="@item.Icon">
            <BodyContent>
                <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
                    <MudText Style="justify-self: start;">@item.Text</MudText>
                    <div style="justify-self: end;">
                        <MudIconButton Icon="@Icons.Material.Filled.Edit" Size="Size.Medium" Color="Color.Inherit" />
                        <MudIconButton Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" Color="Color.Inherit" />
                    </div>
                </div>
            </BodyContent>
        </MudTreeViewItem>
    </ItemTemplate>
</MudTreeView>


@code {

    private HashSet<TreeItemData> TreeItems { get; set; } = new HashSet<TreeItemData>();

    public class TreeItemData
    {
        public string Text { get; set; }

        public string Icon { get; set; }

        public HashSet<TreeItemData> TreeItems { get; set; } = new HashSet<TreeItemData>();

        public TreeItemData(string text, string icon)
        {
            Text = text;
            Icon = icon;
        }
    }

    protected override void OnInitialized()
    {
        TreeItems.Add(new TreeItemData(".github", Icons.Custom.Brands.GitHub));
        TreeItems.Add(new TreeItemData(".vscode", Icons.Custom.Brands.MicrosoftVisualStudio));
        TreeItems.Add(new TreeItemData("content", Icons.Custom.FileFormats.FileDocument));
        TreeItems.Add(new TreeItemData("src", Icons.Custom.FileFormats.FileCode)
        {
            TreeItems = new HashSet<TreeItemData>()
            {
                new TreeItemData("MudBlazor", Icons.Custom.Brands.MudBlazor),
                new TreeItemData("MudBlazor.Docs", Icons.Custom.FileFormats.FileDocument)
                {
                    TreeItems = new HashSet<TreeItemData>()
                    {
                        new TreeItemData("_Imports.razor", Icons.Material.Filled.AlternateEmail),
                        new TreeItemData( "compilerconfig.json", Icons.Custom.FileFormats.FileImage),
                        new TreeItemData( "MudBlazor.Docs.csproj", Icons.Custom.Brands.MicrosoftVisualStudio),
                        new TreeItemData("NewFilesToBuild.txt" , Icons.Custom.FileFormats.FileDocument),
                    }
                },
                new TreeItemData("MudBlazor.Docs.Client", Icons.Material.Filled.Folder),
                new TreeItemData("MudBlazor.Docs.Compiler", Icons.Material.Filled.Folder),
                new TreeItemData("MudBlazor.Docs.Server", Icons.Material.Filled.Folder),
                new TreeItemData("MudBlazor.UnitTests", Icons.Material.Filled.Folder),
                new TreeItemData("MudBlazor.UnitTests.Viewer", Icons.Material.Filled.Folder),
                new TreeItemData(".editorconfig", Icons.Custom.FileFormats.FileCode),
                new TreeItemData("MudBlazor.sln", Icons.Custom.Brands.MicrosoftVisualStudio)
            }
        });
        TreeItems.Add(new TreeItemData("History", Icons.Material.Filled.Folder));
    }
}
